package com.wear.service.impl;

import com.wear.domain.Snap;
import com.wear.repository.SnapRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wear.service.SnapService;

import java.util.List;

/**
 * @author 作者 E-mail:ben.chen@accentrix.com
 * @version 创建时间：2019/3/11
 */
@Service
@Transactional
public class SnapServiceImpl implements SnapService {
    @Autowired
    private SnapRepository snapRepository;

    @Override
    public void save(String snapId, String order) {
        Snap snap = new Snap();
        snap.setSnapId(snapId);
        snap.setOrderNo(order);
        snapRepository.save(snap);
    }

    @Override
    public void deleteAll() {
        snapRepository.deleteAll(snapRepository.findAll());
    }

    @Override
    public List<Snap> findAll() {
        return snapRepository.findAll();
    }
}
